﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using COFE.IO;

namespace COFE.Core.Filter
{
    /// <summary>
    /// Used by IInternalDirectoryInfoExA 's EnumerateFSIs() getMethod to specify which directory to look in.
    /// </summary>
    public interface ILookupFilter
    {
        /// <summary>
        /// Whether to contine lookup in the specified directory.
        /// </summary>
        bool ContinueLookup(IInternalDirectoryInfoExA directory);
    }

    /// <summary>
    /// Extends ILookupFilter
    /// </summary>
    public static class ILookupFilterExtension
    {
        public static bool ContinueLookup(this ILookupFilter[] lookupFilters, IInternalDirectoryInfoExA entry)
        {
            foreach (var filter in lookupFilters)
                if (filter.ContinueLookup(entry))
                    return true;
            return false;
        }
    }
}
